package com.micro.modual.extension;

import com.micro.common.MicroConstant;
import com.micro.common.biz.GeneratorCodeUtil;
import com.micro.common.util.SnowFlakeUtil;
import com.micro.modual.entity.GoodsBrand;
import com.micro.modual.model.bo.goodsbrand.GoodsBrandBO;

import java.util.Date;

/**
 * <h1>商品品牌表 延展类</h1>
 *
 * @author LevelCoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020-08-04 00:23:27
 */
public class GoodsBrandExtension {

    /**
     * <h2>转换: 商品品牌表 新增</h2>
     *
     * @param goodsBrandBO {@link GoodsBrandBO} 商品品牌表 新增/修改 请求对象
     * @return {@link GoodsBrand} 商品品牌表
     */
    public static GoodsBrand converAddGoodsBrand(GoodsBrandBO goodsBrandBO) {
        GoodsBrand goodsBrand = new GoodsBrand();
        goodsBrand.setId(SnowFlakeUtil.getId());
        goodsBrand.setBrandCode(GeneratorCodeUtil.generatorSystemCode());
        goodsBrand.setBrandName(goodsBrandBO.getBrandName());
        goodsBrand.setBrandImageUrl(goodsBrandBO.getBrandImageUrl());
        goodsBrand.setBrandAcronym(goodsBrandBO.getBrandAcronym());
        goodsBrand.setBrandSort(goodsBrandBO.getBrandSort());
        goodsBrand.setBrandStatus(goodsBrandBO.getBrandStatus());
        goodsBrand.setCreateTime(new Date());
        return goodsBrand;
    }

    /**
     * <h2>转换: 商品品牌表 修改</h2>
     *
     * @param goodsBrandBO {@link GoodsBrandBO} 商品品牌表 新增/修改 请求对象
     * @return {@link GoodsBrand} 商品品牌表
     */
    public static GoodsBrand converEditGoodsBrand(GoodsBrandBO goodsBrandBO) {
        GoodsBrand goodsBrand = new GoodsBrand();
        goodsBrand.setId(goodsBrandBO.getId());
        goodsBrand.setBrandName(goodsBrandBO.getBrandName());
        goodsBrand.setBrandImageUrl(goodsBrandBO.getBrandImageUrl());
        goodsBrand.setBrandAcronym(goodsBrandBO.getBrandAcronym());
        goodsBrand.setBrandSort(goodsBrandBO.getBrandSort());
        goodsBrand.setBrandStatus(goodsBrandBO.getBrandStatus());
        goodsBrand.setUpdateTime(new Date());
        return goodsBrand;
    }
}
